<?php
/**
 * The loop that displays a single post.
 *
 * The loop displays the posts and the post content.  See
 * http://codex.wordpress.org/The_Loop to understand it and
 * http://codex.wordpress.org/Template_Tags to understand
 * the tags used in it.
 *
 * This can be overridden in child themes with loop-single.php.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.2
 */
?>
<?php if (have_posts()) :?>

<?php while (have_posts()) : the_post(); 		
		$custom = get_post_custom($post->ID);
		$bookdate = $custom['bookdate'][0];
		$bookid= $custom['bookid'][0];
		$authors= $custom['bookauthors'][0]; 
		$price= $custom['price'][0];
		$receive_date= $custom['receive_date'][0];
		$receive_from= $custom['from'][0]; 	
		$availablity= $custom['wpbl_availablity'][0];
		$borrower= $custom['wpbl_user'][0];		
		?>
					<h1 class="entry-title"><?php the_title(); ?></h1> <br /><br />
<table border="5" cellpadding="5" cellspacing="15" width="99%" cols="6" id="booklist" class="booklist">
<tr border="1" id="booklist" class="booklist"><th><h3>Book ID:</h3></th><th width="300px" style="width:300px;"><h3>Title:</h3></th><th><h3>Authors</h3></th><th><h3>Category/Class</h3></th></tr>

<tr><td><a href="<?php the_permalink() ?>" title="<?php printf(__("Permanent Link to %s", "wpbl"), the_title_attribute('echo=0')); ?>"><?php echo $bookid; ?></a></td>
<td style="width:400px;"><a href="<?php the_permalink() ?>" title="<?php printf(__("Permanent Link to %s", "wpbl"), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></td>
<td><?php the_terms( $post->ID, 'authors'); ?></td>
<td><?php the_terms( $post->ID, 'classcat'); ?></td>
</tr>
</table>
<br /> 

<table border="5" cellpadding="5" cellspacing="15" width="99%" cols="6" id="bookdetails" class="bookdetails">
<tr border="1" id="bookdetails" class="bookdetails"><th><h3>Book Publishers:</h3></th><th><h3>Editions:</h3></th><th><h3>Price</h3></th><th><h3>Received Date</h3></th><th><h3>From</h3></th><th><h3>List Date</h3></th><th><h3>Availablity</h3></th><th><h3>Borrower</h3></th></tr>

<tr><td><?php the_terms( $post->ID, 'publishers'); ?></td>
<td><?php the_terms( $post->ID, 'editions'); ?></td>
<td><?php echo $price; ?></td>
<td><?php echo $receive_date; ?></td>
<td><?php echo $receive_from; ?></td>
<td><?php the_terms( $post->ID, 'dates'); ?></td>
<td class="<?php echo $availablity; ?>"><?php echo $availablity; ?></td>
<td><?php echo $borrower; ?></td>
</tr>
</table><br /> 

					<div class="entry-content">
<?php
					$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
					if ( $images ) :
				?>						<div style="display:block;float:left;padding:18px;"><a href="<?php the_permalink(); ?>">
						<?php the_post_thumbnail(array( 397,260 ), array( 'class' => 'img-slider' )); ?></a>
					</div>
						<?php else: ?>
						<div style="display:block;float:left;padding:18px;">
							<a href="<?php the_permalink(); ?>"><img class="img-slider" src="<?php bloginfo('template_url'); ?>/images/books.jpg" /></a>
						</div>
						<?php endif; ?> <br />
						<?php the_content(); ?>
										
					</div><!-- .entry-content -->

<?php endwhile; ?><?php else: ?>

<div class="entry">
<p><?php _e('Sorry, no posts matched your criteria.','wpbl'); ?></p>
</div>

<?php endif; ?>
	<?php
    if(function_exists('pagination')) { pagination(); }
    ?>
<br />